/*
 * Created by 岱青海蓝信息系统(北京)有限公司 on 17-6-17 下午5:21
 * Copyright (c) 2017. All rights reserved.
 */

package com.hack.eden.pdfreader.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.hack.eden.pdfreader.R;
import com.hack.eden.pdfreader.fragment.GroupFragment;
import com.hack.eden.pdfreader.fragment.PersonalFragment;
import com.hack.eden.pdfreader.fragment.SingleFragment;
import com.hack.eden.pdfreader.util.BottomBar;
import com.hack.eden.pdfreader.util.CustomFragmentTabHost;

public class HomePageActivity extends AppCompatActivity {
    BottomBar bottomBar;
    CustomFragmentTabHost tabHost;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home_page);
        initView();
    }

    public void initView() {
        bottomBar = (BottomBar) findViewById(R.id.bottom_bar);
        tabHost = (CustomFragmentTabHost) findViewById(android.R.id.tabhost);

        tabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent);
        tabHost.addTab(tabHost.newTabSpec("SingleFragment").setIndicator("SingleFragment"),
                SingleFragment.class, null);
        tabHost.addTab(tabHost.newTabSpec("GroupFragment").setIndicator("GroupFragment"),
                GroupFragment.class, null);
        tabHost.addTab(tabHost.newTabSpec("PersonalFragment").setIndicator("PersonalFragment"),
                PersonalFragment.class, null);

        bottomBar.setOnTabClickListener(new BottomBar.OnTabClickListener() {
            @Override
            public void onTabClick(int position) {
                tabHost.setCurrentTab(position - 1);
            }
        });
    }


}
